echo "|欢迎使用hexo高效部署工具|"
echo "|请不要用root身份运行本程序,会导致文件夹权限问题|"
echo "|本程序将会在最后删除log.txt以维持仓库i同步,报错可以在cmd上观看|"
echo "|请准备按ctrl+c 撤销操作|"
# sleep 5s
cnpm i || echo "|初始化失败|"
echo "|初始化成功!|" 
mv _config.yml vercel_config.yml 
mv gitee_config.yml _config.yml || echo "移动文件出错" >> log.txt
hexo clean || echo "移动文件出错" >> log.txt
hexo g || echo "部署文件出错" >> log.txt
hexo d || echo "推送文件出错" >> log.txt
mv _config.yml gitee_config.yml 
echo "|Gitee推送成功|" 
mv github_config.yml _config.yml || echo "移动文件出错" >> log.txt
hexo clean || echo "移动文件出错" >> log.txt
hexo g || echo "部署文件出错" >> log.txt
cp CNAME public/
echo "|复制CHAME配置文件成功|"
hexo d || echo "推送文件出错" >> log.txt
mv _config.yml github_config.yml 
echo "|Github推送成功|"  
echo "|清准备好登陆heroku|" 
mv heroku_config.yml _config.yml || echo "移动文件出错" >> log.txt
heroku login || echo "登陆错误"
hexo clean || echo "移动文件出错" >> log.txt
hexo g || echo "部署文件出错" >> log.txt
hexo d || echo "推送文件出错" >> log.txt
mv _config.yml heroku_config.yml || echo "移动文件出错" >> log.txt
sudo rm -r .deploy_heroku || echo "|删除文件出错!|"
echo "|Heroku推送成功|"  
mv coding_config.yml _config.yml || echo "移动文件出错" >> log.txt
hexo clean || echo "移动文件出错" >> log.txt
hexo g || echo "部署文件出错" >> log.txt
hexo d || echo "推送文件出错" >> log.txt
mv _config.yml coding_config.yml 
echo "|Coding推送成功|"
mv fast_config.yml _config.yml || echo "移动文件出错" >> log.txt
hexo clean || echo "移动文件出错" >> log.txt
hexo g || echo "部署文件出错" >> log.txt
rm -r ~/Desktop/public/
cp -r public ~/Desktop/ || echo "复制文件出错" >> log.txt
mv _config.yml fast_config.yml 
echo "|Fast推送成功|"
mv vercel_config.yml _config.yml || echo "移动文件出错" >> log.txt
hexo clean || echo "移动文件出错" >> log.txt
hexo g || echo "部署文件出错" >> log.txt
sudo rm -r .deploy_git/ 
echo "|vercel 更新成功,正在删除缓存文件|" 
rm -r log.txt
git add .
git commit -m "update"
git push || echo "推送文件出错" >> log.txt
echo "|Fast推送成功|" 
echo "|任务圆满成功|" 
